Skip to content

Conversation

@kinke
Copy link
Member

@kinke kinke commented Oct 2, 2025

No description provided.

@calvin2021y
Copy link

calvin2021y commented Oct 3, 2025

Any updates on this #4943? We'd love to get it merged with llvm21 if possible!

@kinke
Copy link
Member Author

kinke commented Oct 3, 2025

Any help in #4943 would be appreciated, in case you e.g. have the ability to test it locally - it would e.g. be good to know whether the test failures are legit, or specific to the GHA runner container environment. Troubleshooting via CI is a huge PITA and incredibly time-consuming with the poor feedback times.

@calvin2021y
Copy link

I am not sure how to test it local, I try to build get this error on x86:

Incorrect number of arguments passed to called function!
  call void @llvm.lifetime.start.p0(ptr immarg %5) #2
Incorrect number of arguments passed to called function!
  call void @llvm.lifetime.start.p0(ptr immarg %6) #2
Incorrect number of arguments passed to called function!
  call void @llvm.lifetime.end.p0(ptr immarg %6) #2
Incorrect number of arguments passed to called function!
  call void @llvm.lifetime.end.p0(ptr immarg %5) #2
Incorrect number of arguments passed to called function!
  call void @llvm.lifetime.start.p0(ptr immarg %5) #2
Incorrect number of arguments passed to called function!
  call void @llvm.lifetime.start.p0(ptr immarg %6) #2
Incorrect number of arguments passed to called function!
  call void @llvm.lifetime.end.p0(ptr immarg %6) #2
Incorrect number of arguments passed to called function!
  call void @llvm.lifetime.end.p0(ptr immarg %5) #2
Incorrect number of arguments passed to called function!
  call void @llvm.lifetime.start.p0(ptr immarg %7) #2
Incorrect number of arguments passed to called function!
  call void @llvm.lifetime.end.p0(ptr immarg %7) #2
Incorrect number of arguments passed to called function!
  call void @llvm.lifetime.start.p0(ptr immarg %10) #2
Incorrect number of arguments passed to called function!
  call void @llvm.lifetime.start.p0(ptr immarg %11) #2
Incorrect number of arguments passed to called function!
  call void @llvm.lifetime.end.p0(ptr immarg %11) #2
Incorrect number of arguments passed to called function!
  call void @llvm.lifetime.end.p0(ptr immarg %10) #2
LLVM ERROR: Broken module found, compilation aborted!
Aborted (core dumped)
ninja: subcommands failed

will update aarch64 late.

@thewilsonator
Copy link
Contributor

I am not sure how to test it local, I try to build get this error on x86:
...
will update aarch64 late.

See ffed803
note that phobos will still fail to build as with #4979

@kinke
Copy link
Member Author

kinke commented Oct 4, 2025

@calvin2021y: I meant testing on Alpine AArch64, using a supported LLVM version < 21.

@kinke
Copy link
Member Author

kinke commented Oct 4, 2025

Oof, pretty discouraging first test results for CI.

@calvin2021y
Copy link

@calvin2021y: I meant testing on Alpine AArch64, using a supported LLVM version < 21.

Thanks for the tips. I try build the tests on aarch64. find a problem:

use '-DCMAKE_EXE_LINKER_FLAGS="-static-libstdc++ -fuse-ld=lld"` will blocked by:

ldmd2 -linkonce-templates -O -defaultlib=phobos2-ldc,druntime-ldc -wi -O -inline -release -of/opt/projects/ldc/bin/timetrace2txt /opt/projects/ldc/obj/timetrace2txt.o -gcc=/usr/lib/llvm20/bin/clang++ "-Xcc=-static-libstdc++ -fuse-ld=lld" -Xcc=-static -Xcc=-fuse-ld=lld

clang++: error: unknown argument: '-static-libstdc++ -fuse-ld=lld'

'-static-libstdc++ -fuse-ld=lld' should be 2 arguments here.

@the-horo
Copy link
Contributor

the-horo commented Oct 5, 2025

@calvin2021y: I meant testing on Alpine AArch64, using a supported LLVM version < 21.

Thanks for the tips. I try build the tests on aarch64. find a problem:

use '-DCMAKE_EXE_LINKER_FLAGS="-static-libstdc++ -fuse-ld=lld"` will blocked by:

ldmd2 -linkonce-templates -O -defaultlib=phobos2-ldc,druntime-ldc -wi -O -inline -release -of/opt/projects/ldc/bin/timetrace2txt /opt/projects/ldc/obj/timetrace2txt.o -gcc=/usr/lib/llvm20/bin/clang++ "-Xcc=-static-libstdc++ -fuse-ld=lld" -Xcc=-static -Xcc=-fuse-ld=lld

clang++: error: unknown argument: '-static-libstdc++ -fuse-ld=lld'

'-static-libstdc++ -fuse-ld=lld' should be 2 arguments here.

Use -DCMAKE_EXE_LINKER_FLAGS="-static-libstdc++;-fuse-ld=lld". Separate the arguments by ;, not by .

@thewilsonator
Copy link
Contributor

fix.diff.txt

This fixes a few Lit test suite failures

@thewilsonator
Copy link
Contributor

For the record https://github.com/llvm/llvm-project/blob/main/clang/lib/CodeGen/CGDecl.cpp#L1375 has just Addr now no Size.

@kinke
Copy link
Member Author

kinke commented Nov 9, 2025

For the record https://github.com/llvm/llvm-project/blob/main/clang/lib/CodeGen/CGDecl.cpp#L1375 has just Addr now no Size.

Yep, but that's LLVM 22, not 21: llvm/llvm-project@c23b4fb

@kinke kinke changed the title Bump LDC-LLVM to v21.1.2 Bump LDC-LLVM to v21.1.5 Nov 9, 2025
@kinke
Copy link
Member Author

kinke commented Nov 9, 2025

Okay, looking much better now; the problem was a GC2Stack regression introduced in a recent prepare-for-LLVM-21 PR. - Basically just a std.json unittest regression remaining (with enabled optimizations only), and some linking issue for ldc-profgen on macOS arm64 (with clang 21 at least).

/* How the arg is passed by value is ABI-specific, but the pointer must be aligned.
* When the argument is passed as a byte array and copied into a stack alloc, that stack alloca must be aligned. */
// CHECK: {{(align 32 %arg|%arg = alloca %align.Outer, align 32)}}
// CHECK: {{(align 32 %arg|%arg = alloca %align.Outer, align 32|call void @llvm.memcpy.* %.sret_arg,.* %arg)}}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the memcpy got the correct alignments (instead of 1), we could check them in the regex directly. But currently:

define void @_D5align23passAndReturnOuterByValFSQBh5OuterZQl(ptr noalias sret(%align.Outer) align 32 %.sret_arg, ptr noalias align 32 captures(none) %arg) #0 {
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %.sret_arg, ptr align 1 %arg, i64 32, i1 false)
  ret void
}

// CHECK: define{{.*}} void @{{.*}}_D5align23passAndReturnInnerByValFSQBh5InnerZQl
// CHECK-SAME: ptr {{noalias sret.*|inreg noalias}} align 32 %.sret_arg
// CHECK: {{(align 32 %arg|%arg = alloca %align.Inner, align 32)}}
// CHECK: {{(align 32 %arg|%arg = alloca %align.Inner, align 32|call void @llvm.memcpy.* %.sret_arg,.* %arg)}}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto

Don't just use Homebrew clang 21 for macOS arm64, but x86_64 too, as
LDC-LLVM uses it consistently too now.

Also bump the macOS x86_64 image from macos-13 to macos-15-intel
(while using macos-15 for macOS arm64).

The Homebrew clang 21 apparently needs 2 tweaks:
* use in combination with the Command Line Tools, not Xcode
* remove the bundled libc++ headers, using the macOS ones instead
  (matching the *linked* libc++)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants